package br.com.globalcode.clinicafacil.config;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.net.URL;

public class ConfigReader {
	
	public void move() {
		
		File file = new File("clinicafacil.properties");
		
		
	}
	
	public String read2() {
		StringBuffer sb = new StringBuffer();
		try {
			BufferedReader reader = new BufferedReader( 
									new FileReader("clinicafacil.properties") );
			String line = "";
			while (  ( line = reader.readLine() ) != null ) {
				sb.append(line).append("\n");
			}	
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return sb.toString();
		
		
	} 
	
	
	public String read() {
		
		StringBuffer sb = new StringBuffer();
		
		InputStream in = null;
		try {
			in = new FileInputStream("clinicafacil.properties");
			int content = 0;
			while( (content = in.read()) != -1 ) {
				sb.append((char) content);
			}
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return sb.toString();
		
	}
	
	
	public static void main(String[] args) {
		
		ConfigReader reader = new ConfigReader();
		String config =  reader.read();
		config += "\n\n\t#-------------------------\n#\n\tEOF";
		ConfigWriter writer =  new ConfigWriter();
		writer.write(config);
		
		
	}
	

}
